package com.example.onlineeducation.viewmodel

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import com.example.onlineeducation.base.BaseViewModel
import com.example.onlineeducation.data.entity.ProInfoEntity
import com.example.onlineeducation.repository.StudyRepository
import com.yc.jetpacklib.net.YcResult
import kotlinx.coroutines.flow.collectLatest

/**
 * Creator:
 * Date: 2022/04/14
 * UseDes:
 */

class AppPushLogViewModel : BaseViewModel() {
    private val mStudyRepository: StudyRepository by lazy { StudyRepository(mApiService) }


//    private val _mRefreshRecordList = MutableLiveData<Boolean>()
//    val mRefreshRecordList: LiveData<Boolean> = _mRefreshRecordList
//


    private val _mPushStudyLog = MutableLiveData<YcResult<Any?>>()
    val mPushStudyLog: LiveData<YcResult<Any?>> = _mPushStudyLog

    fun pushStudyLog(projId: String,times:String,topicId:String) = ycLaunch{
        mStudyRepository.pushStudyLog(projId, times,topicId).collectLatest { result ->
            _mPushStudyLog.postValue(result)
        }
    }

    /*刷新记录*/
//    fun refreshRecord(refresh: Boolean) {
//        _mRefreshRecordList.postValue(refresh)
//    }
}
